package co.unal.sim.queque;

/**
 * Clase que contiene los datos de una cola.
 * 
 * @author Michael Salgado
 * @version 1.0
 */
public class Queue {
	public static final int QUEUE_LIMIT = 100;
	
	private final String name;
	private int numInQueue;
	private double[] arrivalTimes;
	private double meanInterarrival;
	
	public Queue(String name) {
		this.name = name;
		init();
	}
	
	public Queue(String name, double meanInterarrival) {
		this.name = name;
		this.meanInterarrival = meanInterarrival;
		init();
	}
	
	protected void init() {
		arrivalTimes = new double[QUEUE_LIMIT + 1];
		numInQueue = 0;
	}
	
	public int getNumInQueue() {
		return numInQueue;
	}
	
	public void setNumInQueue(int numInQueue) {
		this.numInQueue = numInQueue;
	}
	
	public double[] getArrivalTimes() {
		return arrivalTimes;
	}
	
	public void setArrivalTimes(double[] arrivalTimes) {
		this.arrivalTimes = arrivalTimes;
	}
	
	public double getMeanInterarrival() {
		return meanInterarrival;
	}
	
	public void setMeanInterarrival(double meanInterarrival) {
		this.meanInterarrival = meanInterarrival;
	}

	public String getName() {
		return name;
	}
	
	public void incrementQueue() {
		++numInQueue;
	}
	
	public void decrementQueue() {
		--numInQueue;
	}
	
	public void updateArrivalTimes() {
		for (int i = 1; i <= numInQueue; ++i) {
			arrivalTimes[i] = arrivalTimes[i + 1];
		}
	}
	
	public void addArrivalTimes(double time) {
		arrivalTimes[numInQueue] = time;
	}
}
